//
//  UtilsMacro.h
//  GongZheng
//
//  Created by huan on 2018/4/26.
//  Copyright © 2018年 huan. All rights reserved.
//

#ifndef UtilsMacro_h
#define UtilsMacro_h

#pragma mark - 字体
#define GZFont(x)       [UIFont systemFontOfSize:x]

#pragma mark - 字号
#define GZSubTitleFontSize      12.0f
#define GZNormalFontSize        14.0f
#define GZContentFontSize       16.0f
#define GZButtonTitleFontSize   17.0f
#define GZTitleFontSize         18.0f
#define GZBigTitleFontSize      25.0f
///正常字体
#define G10 GZFont(10.f)
#define G12 GZFont(12.f)
#define G13 GZFont(13.f)
#define G14 GZFont(14.f)
#define G16 GZFont(16.f)
#define G17 GZFont(17.f)
#define G18 GZFont(18.f)
#define G20 GZFont(20.f)
#define G25 GZFont(25.f)
#define G30 GZFont(30.f)

#pragma mark - 屏幕尺寸相关
#define SCREEN_WIDTH   (int)([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT  (int)([UIScreen mainScreen].bounds.size.height)
#define AdjustWidth(x) (x) * SCREEN_WIDTH / 375.0

#pragma mark - 导航栏高度
#define NavigationBar_HEIGHT_X   88
#define NavigationBar_HEIGHT     64
#define atest 10
#define btest 6
#define ctest atest - btest
#define NAV_HEIGHT              (SCREEN_HEIGHT == 812.0 ? NavigationBar_HEIGHT_X : NavigationBar_HEIGHT)

#define Tabbar_HEIGHT            49

#define Button_HEIGHT  45

#define SCREENHEIGHT_NONAV      (SCREEN_HEIGHT - NAV_HEIGHT)
#define SCREENHEIGHT_NONAVTAB   (SCREEN_HEIGHT - NAV_HEIGHT - 49)

#define kAllViewMargin 15.0f        //几乎所有view 的左右边距
#define kCornerRadius 5.0f          //所有空间的圆角
#define kBorderWidth 1.0f           //所有边框的线的粗细

/********通知相关的宏*************/
#define kDEVICETOKEN @"deviceToken"//推送设备标识符
#define PRESENTGESTURE  @"presentGesture"
#define UPDATAFROMSCAN @"updataFromScan"
#define REFRESHDATA @"refreshData"


#pragma mark - iOS系统
#define IOS_SYSTEM [[[UIDevice currentDevice] systemVersion] floatValue]
#pragma mark - iOS版本号
#define IOS_VERSION [[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey] floatValue]

#pragma mark - 本地持久化宏
#define USER_DEFAULT [NSUserDefaults standardUserDefaults]
#define UDSetObjectForKey(VALUE,KEY)  [USER_DEFAULT setObject:VALUE forKey:KEY]
#define UDObjectForKey(KEY)     [USER_DEFAULT objectForKey:KEY]
#define UDRemoveForKey(KEY)     [USER_DEFAULT removeObjectForKey:KEY]
#pragma mark - 颜色相关宏函数
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
#define RGBRANDOMCOLOR RGBACOLOR(arc4random() % 256, arc4random() % 256, arc4random() % 256, 1)

#ifdef DEBUG
#    define HOLog(...) NSLog(__VA_ARGS__)
#else
#    define HOLog(...) /* */
#endif

// View 圆角和加边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

#define HOWeakSelf(weakSelf)  __weak __typeof(&*self)weakSelf = self;

#endif /* UtilsMacro_h */
